package com.yqw.onlineDocs.manager.websocket.model;

import lombok.Getter;

/**
 * 文档编辑操作枚举类
 */
@Getter
public enum DocumentEditOperationEnum {
    INSERT("插入操作", "INSERT"),
    DELETE("删除操作", "DELETE"),
    REPLACE("替换操作", "REPLACE");
    
    private final String text;
    private final String value;
    
    DocumentEditOperationEnum(String text, String value) {
        this.text = text;
        this.value = value;
    }
    
    /**
     * 根据 value 获取枚举
     */
    public static DocumentEditOperationEnum getEnumByValue(String value) {
        if (value == null || value.isEmpty()) {
            return null;
        }
        for (DocumentEditOperationEnum operationEnum : DocumentEditOperationEnum.values()) {
            if (operationEnum.value.equals(value)) {
                return operationEnum;
            }
        }
        return null;
    }
}